package com.czollmann.android;

import java.util.ArrayList;
import java.util.List;

import org.joda.time.DateTime;

public class DateObjectWrapper implements Comparable {
	private DateTime dateTime;
	private List<ObjectWrapper> objects = new ArrayList<ObjectWrapper>();

	public DateObjectWrapper(DateTime dateTime) {
		this.dateTime = dateTime;
	}

	public DateTime getDateTime() {
		return dateTime;
	}

	public void setDateTime(DateTime dateTime) {
		this.dateTime = dateTime;
	}

	public List<ObjectWrapper> getObjects() {
		return objects;
	}

	public void setObjects(List<ObjectWrapper> objects) {
		this.objects = objects;
	}

	public int compareTo(Object obj) {
		if (obj instanceof DateObjectWrapper) {
			if (this.dateTime.isBefore(((DateObjectWrapper) obj).getDateTime()))
				return 1;
			else if (this.dateTime.isAfter(((DateObjectWrapper) obj)
					.getDateTime()))
				return -1;
		}
		return 0;
	}

	@Override
	public String toString() {
		return "DateObjectWrapper [dateTime=" + dateTime + ", objects="
				+ objects + "]";
	}
}
